import scrapy
from scrapy.selector.unified import Selector

class TongchengSpider(scrapy.Spider):
    name = "tongcheng"
    allowed_domains = ["bj.58.com"]
    start_urls = ["https://bj.58.com/sou/?key=%E5%89%8D%E7%AB%AF%E5%BC%80%E5%8F%91"]

    def parse(self, response):

        # 页面内容
        # response.text

        # 二进制数据
        # response.body

        # span: scrapy.selector.unified.Selector = response.xpath('//div[@id="filter"]//a/span')[0]
        span: scrapy.selector.unified.Selector = response.xpath('//div[@id="filter"]//a/span')
        print(type(span))
        print(type(span.extract()[0]))
        print(span.extract())
        pass
